import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 维修统计信息 */
export interface RepairStatics {
          id: number; // 主键
          drawingNoId?: number; // 图号id
          accountId?: number; // 模具台账id
          departId?: number; // 申请部门
          moldCategoryId: number; // 模具分类id
          repairCounts: number; // 维修次数
          repairManHours: number; // 维修工时
          innerRepairCounts: number; // 内修次数
          innerRepairManHours: number; // 内修工时
          outerRepairCounts: number; // 外修次数
          outerRepairManHours: number; // 外修工时
  }

// 维修统计 API
export const RepairStaticsApi = {
  // 查询维修统计分页
  getRepairStaticsPage: async (params: any) => {
    return await request.get({ url: `/mold/repair-statics/page`, params })
  },

  // 查询维修统计详情
  getRepairStatics: async (id: number) => {
    return await request.get({ url: `/mold/repair-statics/get?id=` + id })
  },

  // 新增维修统计
  createRepairStatics: async (data: RepairStatics) => {
    return await request.post({ url: `/mold/repair-statics/create`, data })
  },

  // 修改维修统计
  updateRepairStatics: async (data: RepairStatics) => {
    return await request.put({ url: `/mold/repair-statics/update`, data })
  },

  // 删除维修统计
  deleteRepairStatics: async (id: number) => {
    return await request.delete({ url: `/mold/repair-statics/delete?id=` + id })
  },

  /** 批量删除维修统计 */
  deleteRepairStaticsList: async (ids: number[]) => {
    return await request.delete({ url: `/mold/repair-statics/delete-list?ids=${ids.join(',')}` })
  },

  // 导出维修统计 Excel
  exportRepairStatics: async (params) => {
    return await request.download({ url: `/mold/repair-statics/export-excel`, params })
  },
}